maxPrice=int(input())
prices=list(map(int,input().split()))

def getResult():
    prices.sort()
    left,right,count=0,len(prices)-1,0
    while left<right:
        sumPrice=prices[left]+prices[right]
        if sumPrice<=maxPrice:
            left=left+1
        right=right-1
        count=count+1
    if left==right:
        count=count+1
    return count
print(getResult())